#include <gtk/gtk.h>
#include <stdio.h>

#include "gtkutils.h"

createSignalFunc(sayHello) {
    printf("hello word\n");
}

createSignalFunc(Exit) {
    exit(0);
}

static void activate(GtkApplication *app, gpointer user_data) {
    GtkWindow *window;

    window = createWindowWithTitleSize(app, "gtk-boxAppend-test", 0, 100);

    setWindowChild(window, 
        createBoxWithVerticalAppends(0, 
            createButton("Fuck1"),
            createButton("Fuck2"),
            // 横向 - Button
            createBoxWithHorizntalAppends(0, 
                createButton("Left"),
                createButton("Center"),
                createButton("Right"),
                NULL
            ),
            // 横向 - Label
            createBoxWithHorizntalAppends(20, 
                createLabel("Left"),
                createLabel("Center"),
                createLabel("Right"),
                NULL
            ),
            // 横向 - Button
            createBoxWithHorizntalAppends(0, 
                createButtonAction(NULL, "Hello Word", sayHello),
                createButtonAction(NULL, "Quit", Exit),
                NULL
            ),
            NULL
        )
    );

    showWindow(window);
}

int	main(int argc, char **argv) {
    GtkApplication *app;
    int status;

    app = createApplicationConnectActivate("gtk.example.template", 
                                G_APPLICATION_FLAGS_NONE, activate);
    status = runApplication(app, argc, argv);
    objectUnref(app);

    return status;
}

